<template>
	<div>
		<Menu/>
		<Head/>
		<div class="company_edit_main">
			<div class="company_edit_pro">
				<h3>&nbsp;</h3>
				<h3 style="text-align:center">{{datail.Stock_name}}</h3>
				<h3>&nbsp;</h3>
				<div class="company_edit_pro_info">
					<form>
						<table>
							<tr>
								<td class="tab_edit"> &nbsp; 证券名称</td>
								<td> &nbsp; {{datail.Stock_name}}</td>
								<td class="tab_edit"> &nbsp; 证券编码</td>
								<td> &nbsp; {{datail.Jys}}{{datail.Stock_code}}</td>
							</tr>
							<tr style="background: #F2F6FC;">
								<td> &nbsp; 筹码90%-A</td>
								<td> &nbsp; <input type="text" :value="seventy_percent" /></td>
								<td> &nbsp; 筹码90%-B</td>
								<td> &nbsp; <input type="text" :model="ninety_percent" :value="ninety_percent" /></td>
							</tr>
							<tr>
								<td> &nbsp; 平均成本值</td>
								<td> &nbsp; <input type="text" :model="average_cost" :value="average_cost" /> </td>
								<td> &nbsp; 集中度</td>
								<td> &nbsp; <input type="text" :model="market_concentration" :value="market_concentration" /></td>
							</tr>
						</table>
						  <div class="mb-4" style="margin-top: 1%;">
							<input type="hidden" :model="sid" :value="sid" />
						    <el-button type="primary" @click="editCompanyDatail">确 定</el-button>
						  </div>
					</form>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	import Menu from '../../components/Menu.vue'
	import Head from '../../components/Head.vue'
	import axios from 'axios'
	export default {
		name:"CompanyEditView",
		components:{
			Menu,
			Head,
		},
		data(){
			return {
				datail:'',
				average_cost:'',
				seventy_percent:'',
				ninety_percent:'',
				market_concentration:'',
				sid:''
			}
		},
		methods:{
			getCompanyDatail(){
				var thisInfo = this
				let data = new FormData();
				data.append('id',this.$route.params.id);
				this.$axios.post('/api/v1/company/company_detail',data, {headers:{"Content-Type":'"multipart/form-data;charset=UTF-8'}}).then(function (response) {
					thisInfo.datail = response.data.data
					thisInfo.average_cost = response.data.data.Average_cost
					thisInfo.seventy_percent = response.data.data.Seventy_percent
					thisInfo.ninety_percent = response.data.data.Ninety_percent
					thisInfo.market_concentration = response.data.data.Market_concentration
					thisInfo.sid = response.data.data.Sid
				});
			},
			
			editCompanyDatail(){
				
				if (this.average_cost == 0 || this.average_cost==undefined || this.average_cost=='0' || this.average_cost=='0.0' || this.average_cost=='0.00' || this.average_cost=='0.000' || this.average_cost=='0.0000') {
					alert('筹码90%-A无效');
					return
				}
				if (this.seventy_percent == 0 || this.seventy_percent==undefined || this.seventy_percent=='0' || this.seventy_percent=='0.0' || this.seventy_percent=='0.00' || this.seventy_percent=='0.000' || this.seventy_percent=='0.0000') {
					alert('筹码90%-B无效');
					return
				}
				if (this.ninety_percent == 0 || this.ninety_percent==undefined || this.ninety_percent=='0' || this.ninety_percent=='0.0' || this.ninety_percent=='0.00' || this.ninety_percent=='0.000' || this.ninety_percent=='0.0000') {
					alert('筹码90%-B无效');
					return
				}
				if (this.market_concentration == 0 || this.market_concentration==undefined || this.market_concentration=='0' || this.market_concentration=='0.0' || this.market_concentration=='0.00' || this.market_concentration=='0.000' || this.market_concentration=='0.0000') {
					alert('筹码90%-B无效');
					return
				}
				console.log("seventy_percent: "+this.seventy_percent)
				// let data = new FormData();
				// data.append('sid',this.sid);
				// data.append('average_cost',this.average_cost);
				// data.append('seventy_percent',this.seventy_percent);
				// data.append('ninety_percent',this.ninety_percent);
				// data.append('market_concentration',this.market_concentration);
				// this.$axios.post('api/v1/company/company_edit', data, {headers:{'Content-Type':'multipart/form-data; charset=utf-8', 'Accept':'*/*','Connection':'keep-alive'}}).then(function (response) {
				// 	alert(response.data.data);
				// });
			},
		},
		mounted: function(){
			this.getCompanyDatail();
			
		}
	}
</script>
<style scoped>
	*{
		padding: 0;
		margin:0;
	}
	ul{
		list-style:none;
		display:flex;
		flex-wrap:wrap;
	}
	li{
		list-style-type:none;
		text-align: center;
	}
	table, td{
		border:1px solid #EBEEF5;
		border-spacing: 0;
		border-collapse: collapse;
		
	}
	td{
		width:320px;
		height: 50px;
	}
	.company_edit_main{
		float: left;
		width: 88%;
		height: 850px;
	}
	.company_edit_pro{
		float: left;
		margin-left: 5%;
		margin-top: 2%;
		width: 80%;
		height: 816px;
		border:1px solid #EAEAEA;
	}
	.company_edit_pro_info{
		float: left;
		margin-left: 2%;
	}
	.tab_edit{
		font-family: ARIAL,"Microsoft Yahei","微软雅黑";
		font-weight: bold;
	}
</style>